package com.xp.code.view;

import javax.annotation.Resource;

import net.sf.json.JSONObject;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ModelDriven;
import com.xp.code.servicesImpl.DeptInfoService;
import com.xp.code.vo.DeptInfoVO;

/**
 * 
 * @author HAHA
 *
 */
@Controller("deptInfoAction")
@Scope("prototype")
public class DeptInfoAction extends XPInfoAction implements ModelDriven<DeptInfoVO>{

	
	private DeptInfoVO deptInfoVO;
	@Resource(name="deptInfoService")
	private DeptInfoService deptInfoService;
	
	
	public DeptInfoAction() {
		
	}

	public DeptInfoVO getModel() {
		deptInfoVO=new DeptInfoVO();
		return deptInfoVO;
	}

	public DeptInfoService getDeptInfoService() {
		return deptInfoService;
	}

	public void setDeptInfoService(DeptInfoService deptInfoService) {
		this.deptInfoService = deptInfoService;
	}

	public String addDeptInfos()throws Exception{
		DeptInfoVO vo=deptInfoService.addDeptInfos(deptInfoVO);
		JSONObject jo=JSONObject.fromObject(vo);
		setJsonString(jo.toString());
		return SUCCESS;
	}
}
